<?php
namespace Reseller\Controller;
use Think\Controller;
class PublicController extends CommonController {
    public function login(){
		session("aid")?$this->redirect("Index/index"):$this->display();		
	}
	
	/**
	*登录账户	
	*/	
	public function checkin(){
		//先核对验证码
		$this->checkCode();
		$con['aff_id']=I('username');
		$con['aff_isactive']=1;		
		$result=M("affiliate")->where($con)->find();
		//dump(I());
		//dump($result);exit;
		if(!$result || md5(I('password').$result['aff_salt'])!=$result['aff_pwd'])
			$this->error(L("invalid_login"));
		
			session("aid",$result['aff_id']);
			$this->success(L("login_success"),U('Index/index'));
	}
	
	public function logout(){
		session("aid",null);
		$this->success(L('logout_success'),U('Home/Public/login'));
	}
}

